home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
fp
/
ifp_unix.lzh
/
ifp
/
fproot
/
demo
/
Euler
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1987-02-01
|
281 b
|
13 lines
(*
* Compute Euler's phi-function, i.e. number of number rel. prime to n.
*
* E.g. 8:Euler -> 4 since 1,3,5,7 are relatively prime to 8
*)
DEF Euler AS
[id,iota] | distl |
EACH
WHILE [2,#0]|> DO [2,mod] END |
IF [1, #1]|= THEN #1 ELSE #0 END
END | sum;